/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cersoft.xmascharity.ejb;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.cersoft.xmascharity.entity.Payment;

/**
 *
 * @author pbo
 */
@Stateless
public class PaymentFacade extends AbstractFacade<Payment> {
    @PersistenceContext(unitName = "XmasCharityPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public Double getSum(){
        double res = 0.0;
        try {
            res = (Double)em.createNamedQuery("findSum").getSingleResult();
        } catch (Exception e) {}
        return res;
    }
    
    public PaymentFacade() {
        super(Payment.class);
    }
    
}
